import type { PaginationProps } from 'antd';
import { Pagination } from 'antd';

type Props = {
  total: number;
  pageChange: (pageNumber: number) => void;
};

const Paging: React.FC<Props> = ({ total, pageChange }) => {
  const handlePageChange: PaginationProps['onChange'] = (pageNumber) => {
    pageChange(pageNumber);
  };

  return (
    <Pagination
      showSizeChanger={false}
      align="center"
      showTotal={(total) => `共 ${total} 个`}
      total={total}
      onChange={handlePageChange}
    />
  );
};

export default Paging;
